import React, { useEffect, useState } from 'react'

import styles from './index.module.css'

import { encryptECB, decryptECB, encryptCBC, decryptCBC } from '../../utils/crypt'
import CryptoJS from 'crypto-js'

//管理员设置页面
function AdminSetting() {

    //[]空数组相当于componentDidMount
    useEffect(() => {
        initData();
        return () => {
        }
    }, []);

    function initData() {
        //ECB加解密
        // const key = 'QHilvk7D3Phq766hQHilvk7D3Phq766h';
        // const str = '这是一条内容!hahahah哈哈哈123123';
        // const aaa = encryptECB(str, key)
        // console.log('加密后：' + aaa);
        // const bbb = decryptECB(aaa, key)
        // console.log('解密后：' + bbb);


        // //GCM加解密
        const key = 'QHilvk7D3Phq766hQHilvk7D3Phq766h'; // 256位密钥
        const plaintext = '这是一条内容!hahahah哈哈哈123123';
        const aaa = encryptCBC(plaintext, key)
        console.log('加密后：' + aaa);
        console.log('-------------------------------');

        //先获取偏移量
        // const ivHex = aaa.substring(0, 32);
        // console.log('ivHex：' + ivHex);
        // const ccc = aaa.substring(32);
        // console.log('cccc:' + ccc);
        const bbb = decryptCBC("694fbe83c583461442741ede158f4d2430+E3TPRVyAdRTLrXGV9V+c80f2Mv+VqnPRyDw191FPj9r3uiXCJ8x9Jch8HCxpljzuga8kA2VfrgDrK2ZJhj9D7IoD8Ux9zHHXT8P3sjnneLjLrxFq+FSSu2onthso9", key)
        console.log('解密后：' + bbb);

    }


    return (
        <div className={styles.container}>
            <span className={styles.title_text}>统计一览表</span>

        </div>
    )
}

export default AdminSetting;